home *** CD-ROM | disk | FTP | other *** search
/ Belgian Amiga Club - ADF Collection / BS1 part 05.zip / BS1 part 5 / CrossDOS_Plus.adf / Install < prev    next >
Text File  |  1992-09-07  |  30KB  |  1,383 lines

  1. ;********************************************************************
  2. ;Installation script for CrossDOS 5+ (including CrossPC)
  3. ;********************************************************************
  4.  
  5. ;Version 5.04
  6. ;August 28, 1992
  7.  
  8. ;Important: Before shipping, replace all references to ":" with ":".
  9.  
  10. ;Bugs in Installer V1.22:
  11.  
  12. ;1. The "run" command does not accept a relative path.
  13. ;2. The tooltype delete feature is case-sensitive.
  14. ;3. May get "not a dos disk" requesters at start-up.
  15.  
  16.  
  17. ;mycopylib is used because of installer limitations. It uses the following global
  18. ;strings as input:
  19. ;mysource - source
  20. ;mydest - destination
  21. ;mynewname - new name
  22.  
  23. (procedure mycopylib
  24.     (
  25.         (set errorflag 0)
  26.         ;form destination file
  27.         (set destfile
  28.             (tackon mydest mynewname)
  29.         )
  30.         (if
  31.             (= 0
  32.                 (exists destfile)
  33.             )
  34.             (
  35.                 (copyfiles
  36.                     (source mysource)
  37.                     (dest mydest)
  38.                     (newname mynewname)
  39.                 )
  40.                 (set errorflag 1)
  41.             )
  42.             (
  43.                 ;the destfile exists, so we must check the versions
  44.                 (if
  45.                     (exists mysource)
  46.                     (
  47.                         (set sourcevernum (getversion mysource))
  48.                         (set sourcever (/ sourcevernum 65536))
  49.                         (set sourcerev (- sourcevernum (* sourcever 65536)))
  50.                         (set destvernum (getversion destfile))
  51.                         (set destver (/ destvernum 65536))
  52.                         (set destrev (- destvernum (* destver 65536)))
  53.                         (if
  54.                             (or
  55.                                 (or
  56.                                     (not ks20)
  57.                                     (> sourcever destver)
  58.                                 )
  59.  
  60.                                 (
  61.                                     (and
  62.                                         (= sourcever destver)
  63.                                         (>= sourcerev destrev)
  64.                                     )
  65.                                 )
  66.                             )
  67.                             (
  68.                                 (copyfiles
  69.                                     (source mysource)
  70.                                     (dest mydest)
  71.                                     (newname mynewname)
  72.                                 )
  73.                                 (set errorflag 1)
  74.                             )
  75.                         )
  76.                     )
  77.                 )
  78.             )
  79.         )
  80.         (if
  81.             (= errorflag 0)
  82.             (
  83.                 ;Handle a version conflict
  84.                 (if
  85.                     (= @user-level 2)
  86.                     (
  87.                         (if
  88.                             (askbool
  89.                                 (prompt (cat "The version of \"" mynewname)
  90.                                          "\" currently on your system appears to be "
  91.                                          "newer than the CrossDOS version."
  92.                                 )
  93.                                 (choices "Overwrite"
  94.                                          "Skip"
  95.                                 )
  96.                                 (help "This message should only appear if you are "
  97.                                       "running Workbench 2.1 or later. If you are not, "
  98.                                       "select Overwrite to copy the CrossDOS file anyway."
  99.                                 )                            
  100.                             )
  101.                             (
  102.                                 (copyfiles
  103.                                     (source mysource)
  104.                                     (dest mydest)
  105.                                     (newname mynewname)
  106.                                 )
  107.                                 (set errorflag 1)
  108.                             )
  109.                         )
  110.                     )
  111.                 )
  112.             )
  113.         )
  114.     )
  115. )
  116.  
  117.  
  118. (procedure InstallTDPatch
  119.     (
  120.         ;Install TDPatch12/TDPatch13
  121.  
  122.         (if
  123.             (< osver 35)
  124.             (
  125.                 (if
  126.                     (= osver 33)
  127.                     (
  128.                         (set patch "TDPatch12 >nil:")
  129.                         (copyfiles
  130.                             (source ":c/TDPatch12")
  131.                             (dest "c:")
  132.                             (newname "TDPatch12")
  133.                         )
  134.                     )
  135.                     (
  136.                         (set patch "TDPatch13 >nil:")
  137.                         (copyfiles
  138.                             (source ":c/TDPatch13")
  139.                             (dest "c:")
  140.                             (newname "TDPatch13")
  141.                         )
  142.                     )
  143.                 )
  144.                 (if
  145.                     (= @user-level 2)
  146.                     (message "You are running Kickstart 1.2 or 1.3. "
  147.                              "A special patch utility called TDPatch12/"
  148.                              "TDPatch13 is REQUIRED for CrossDOS/CrossPC to function "
  149.                              "on your system. This file was copied to "
  150.                              "your C: directory."
  151.                     )
  152.                 )
  153.             )
  154.         )
  155.     )
  156. )
  157.  
  158.  
  159. ;SetHD -- place hard drive information (e.g. C=PCC) in the CrossPC tooltypes
  160. ;harddisk -- e.g. PCC
  161. ;pcdir -- directory of CrossPC icon
  162.  
  163. (procedure SetHD
  164.     (
  165.         ;If the user has configured a hard drive during this session,
  166.         ;add an appropriate tooltype.
  167.  
  168.         (if
  169.             (not
  170.                 (= harddisk "")
  171.             )
  172.             (
  173.                 ;Grab the last character of harddisk and place it in hdchar
  174.                 (set hdchar
  175.                     (substr harddisk
  176.                         (-
  177.                             (strlen harddisk)
  178.                             1
  179.                         )
  180.                         1
  181.                     )
  182.                 )
  183.  
  184.                 (if
  185.                     (not
  186.                         (exists
  187.                             (tackon pcdir "CrossPC.info")
  188.                         )
  189.                     )
  190.                     (message "Warning: Can't find CrossPC's icon. CrossPC will not be configured.")
  191.                 )
  192.  
  193.                 (tooltype
  194.                     (dest (tackon pcdir "CrossPC"))
  195.                     (noposition)
  196.                     (settooltype hdchar harddisk)
  197.                 )
  198.             )
  199.         )
  200.     )
  201. )
  202.  
  203.  
  204. ;MountHD -- mount the thing and place junk into s:user-startup
  205. ;harddisk -- e.g. PCC
  206.  
  207. (procedure MountHD
  208.     (
  209.         ;If the user has configured a hard drive during this session,
  210.         ;mount etc.
  211.  
  212.         (if
  213.             (not
  214.                 (= harddisk "")
  215.             )
  216.             (
  217.                 ;Mount the hard drive the user just configured.
  218.  
  219.                 (run
  220.                     (cat @execute-dir
  221.                         (cat "c/mount >nil: devs:DOSDrivers/" harddisk)
  222.                     )
  223.                 )
  224.  
  225.                 ;Install into s:user-startup
  226.  
  227.                 (startup
  228.                     (cat "CrossDOSV5+ - mounting hard drive "
  229.                         (cat harddisk ":")
  230.                     )
  231.                     (prompt "About to add a command in s:user-startup to automatically "
  232.                             "mount the hard drive you configured..."
  233.                     )
  234.                     (help "If you elect not to add the mount command to your user-startup, "
  235.                           "you may mount the drive simply by clicking on its icon."
  236.                     )
  237.                     (command
  238.                         (cat prefix
  239.                             (cat "Mount >nil: DEVS:DOSDrivers/" harddisk)
  240.                         )
  241.                     )
  242.                 )
  243.             )
  244.         )
  245.     )
  246. )
  247.  
  248.  
  249. ;********************** CrossDOS installation **************************
  250.  
  251. (procedure InstallCrossDOS
  252.     (
  253.         (message "About to install CrossDOS...")
  254.  
  255.         ;Delete an old installation of CrossDOS
  256.  
  257.         (if
  258.             (exists "l:msdosfilesystem")
  259.             (set old 1)    ;if old
  260.             (set old 0)    ;if not old
  261.         )
  262.  
  263.         (if old
  264.             (
  265.                 (message "About to delete a previous CrossDOS installation...")
  266.  
  267. ;sys:system
  268.                 (delete "sys:system/diskchg")
  269.                 (delete "sys:system/diskchk")
  270.                 (delete "sys:system/IntlTrans")
  271.                 (delete "sys:system/kill")
  272.                 (delete "sys:system/mdiskcopy")
  273.                 (delete    "sys:system/mformat")
  274.                 (delete "sys:system/txfilter")
  275.  
  276.                 (delete "sys:system/diskchg.info")
  277.                 (delete "sys:system/diskchk.info")
  278.                 (delete "sys:system/IntlTrans.info")
  279.                 (delete "sys:system/kill.info")
  280.                 (delete "sys:system/mdiskcopy.info")
  281.                 (delete    "sys:system/mformat.info")
  282.                 (delete "sys:system/txfilter.info")
  283.  
  284.                 (delete "sys:system/Atari_S9.MFormat.info")
  285.                 (delete "sys:system/Atari_D9.MFormat.info")
  286.                 (delete "sys:system/MSDOS_D9.MFormat.info")
  287.                 (delete "sys:system/MSDOS_S9.MFormat.info")
  288.                 (delete "sys:system/MSDOS_QD9.MFormat.info")
  289.                 (delete "sys:system/MSDOS_Q18.MFormat.info")
  290.  
  291.                 (delete "sys:system/DiskChg.di0.info")
  292.                 (delete "sys:system/DiskChg.di1.info")
  293.                 (delete "sys:system/DiskChg.di2.info")
  294.                 (delete "sys:system/DiskChg.di3.info")
  295.  
  296.                 (delete "sys:system/Kill.di0.info")
  297.                 (delete "sys:system/Kill.di1.info")
  298.                 (delete "sys:system/Kill.di2.info")
  299.                 (delete "sys:system/Kill.di3.info")
  300.  
  301.                 (delete "sys:system/TxFilter.di0.info")
  302.                 (delete "sys:system/TxFilter.di1.info")
  303.                 (delete "sys:system/TxFilter.di2.info")
  304.                 (delete "sys:system/TxFilter.di3.info")
  305.  
  306. ;sys:crossdos
  307.                 (delete "sys:crossdos/diskchg")
  308.                 (delete "sys:crossdos/diskchk")
  309.                 (delete "sys:crossdos/IntlTrans")
  310.                 (delete "sys:crossdos/kill")
  311.                 (delete "sys:crossdos/mdiskcopy")
  312.                 (delete    "sys:crossdos/mformat")
  313.                 (delete "sys:crossdos/txfilter")
  314.  
  315.                 (delete "sys:crossdos/diskchg.info")
  316.                 (delete "sys:crossdos/diskchk.info")
  317.                 (delete "sys:crossdos/IntlTrans.info")
  318.                 (delete "sys:crossdos/kill.info")
  319.                 (delete "sys:crossdos/mdiskcopy.info")
  320.                 (delete    "sys:crossdos/mformat.info")
  321.                 (delete "sys:crossdos/txfilter.info")
  322.  
  323.                 (delete "sys:crossdos/Atari_S9.MFormat.info")
  324.                 (delete "sys:crossdos/Atari_D9.MFormat.info")
  325.                 (delete "sys:crossdos/MSDOS_D9.MFormat.info")
  326.                 (delete "sys:crossdos/MSDOS_S9.MFormat.info")
  327.                 (delete "sys:crossdos/MSDOS_QD9.MFormat.info")
  328.                 (delete "sys:crossdos/MSDOS_Q18.MFormat.info")
  329.  
  330.                 (delete "sys:crossdos/DiskChg.di0.info")
  331.                 (delete "sys:crossdos/DiskChg.di1.info")
  332.                 (delete "sys:crossdos/DiskChg.di2.info")
  333.                 (delete "sys:crossdos/DiskChg.di3.info")
  334.  
  335.                 (delete "sys:crossdos/Kill.di0.info")
  336.                 (delete "sys:crossdos/Kill.di1.info")
  337.                 (delete "sys:crossdos/Kill.di2.info")
  338.                 (delete "sys:crossdos/Kill.di3.info")
  339.  
  340.                 (delete "sys:crossdos/TxFilter.di0.info")
  341.                 (delete "sys:crossdos/TxFilter.di1.info")
  342.                 (delete "sys:crossdos/TxFilter.di2.info")
  343.                 (delete "sys:crossdos/TxFilter.di3.info")
  344.  
  345.                 (delete "sys:crossdos/.info")
  346.                 (delete "sys:crossdos")
  347.  
  348.                 (if
  349.                     (not
  350.                         (exists "sys:crossdos")
  351.                     )
  352.                     (delete "sys:crossdos.info")
  353.                 )
  354.  
  355.                 ;***** End of deleting *****
  356.  
  357.                 ;Replace old MountMF command
  358.                 (if
  359.                     (exists "sys:mountmf")
  360.                     (copyfiles
  361.                         (source ":c/MountMF")
  362.                         (dest "sys:")
  363.                         (newname "MountMF")
  364.                     )
  365.                 )
  366.                 (if
  367.                     (exists "sys:crossdos/mountmf")
  368.                     (copyfiles
  369.                         (source ":c/MountMF")
  370.                         (dest "sys:CrossDOS")
  371.                         (newname "MountMF")
  372.                     )
  373.                 )
  374.                 (if
  375.                     (exists "c:mountmf")
  376.                     (copyfiles
  377.                         (source ":c/MountMF")
  378.                         (dest "c:")
  379.                         (newname "MountMF")
  380.                     )
  381.                 )
  382.                 (if
  383.                     (exists "sys:wbstartup/mountmf")
  384.                     (copyfiles
  385.                         (source ":c/MountMF")
  386.                         (dest "sys:wbstartup")
  387.                         (newname "MountMF")
  388.                     )
  389.                 )
  390.             )
  391.         )
  392.  
  393.         ;Create certain directories if they don't exist
  394.         (makedir "l:FileSystem_Trans"
  395.             (infos)
  396.         )
  397.         (makedir "sys:system"
  398.             (infos)
  399.         )
  400.  
  401.         ;The purpose of this is to create an icon for the devs: directory
  402.         ;if needed.
  403.         (makedir
  404.             (getassign "devs")
  405.             (infos)
  406.         )
  407.         (makedir "devs:DOSDrivers"
  408.             (infos)
  409.         )
  410.  
  411.         (if ks20
  412.             (set postfix ".2")
  413.             (set postfix "")
  414.         )
  415.  
  416.         ;Put up menu asking about diskcopy/format/mount
  417.  
  418.         (set utilopt 0)
  419.         (if @user-level
  420.             (set utilopt
  421.                 (askchoice
  422.                     (prompt "CrossDOS is supplied with greatly enhanced DiskCopy, Format "
  423.                             "and Mount commands. We recommend replacing the existing commands "
  424.                             "to allow greater functionality. "
  425.                             "Please select an "
  426.                             "option:"
  427.                     )
  428.                     (choices "Replace existing commands"
  429.                              "Rename to CDDiskCopy, CDFormat, CDMount"
  430.                     )
  431.                     (help "Most users will want to replace their old commands with "
  432.                           "the enhanced commands, because the old commands offer "
  433.                           "no advantage. If you are fond of the old commands you may "
  434.                           "choose to install the commands with a different name, starting with "
  435.                           "CD (Cross Dos). Note that the replace option will NOT "
  436.                           "overwrite your commands if you have a newer version "
  437.                           "than we supply."
  438.                     )
  439.                 )
  440.             )
  441.         )
  442.         (if
  443.             (= utilopt 0)
  444.             (set prefix "")
  445.         )
  446.         (if
  447.             (= utilopt 1)
  448.             (set prefix "CD")
  449.         )
  450.  
  451.         (InstallTDPatch)
  452.  
  453.         ;Install mfm.device
  454.  
  455.         (copyfiles
  456.             (source ":devs/mfm.device")
  457.             (dest "devs:")
  458.             (newname "mfm.device")
  459.         )
  460.  
  461.         ;Install Mount command
  462.  
  463.         (set mysource (cat ":c/Mount" postfix))
  464.         (set mydest "c:")
  465.         (set mynewname (cat prefix "Mount"))
  466.         (mycopylib)
  467.  
  468.         ;Install CrossDOSFileSystem
  469.  
  470.         (copyfiles
  471.             (source (cat ":l/CrossDOSFileSystem" postfix))
  472.             (dest "l:")
  473.             (newname "CrossDOSFileSystem")
  474.         )
  475.         (if old
  476.             (copyfiles
  477.                 (source (cat ":l/CrossDOSFileSystem" postfix))
  478.                 (dest "l:")
  479.                 (newname "MSDOSFileSystem")
  480.             )
  481.         )
  482.  
  483.         ;Copy devs:dosdrivers
  484.         (foreach ":" "PC?"
  485.             (
  486.                 (copyfiles
  487.                     (source
  488.                         (cat ":" @each-name)
  489.                     )
  490.                     (dest "devs:DOSDrivers")
  491.                     (newname @each-name)
  492.                 )
  493.                 (copyfiles
  494.                     (source
  495.                         (cat ":"
  496.                             (cat @each-name ".info")
  497.                         )
  498.                     )
  499.                     (dest "devs:DOSDrivers")
  500.                     (newname
  501.                         (cat @each-name ".info")
  502.                     )
  503.                 )
  504.                 (tooltype
  505.                     (dest
  506.                         (cat "devs:DOSDrivers/" @each-name)
  507.                     )
  508.                     (noposition)
  509.                     (setdefaulttool
  510.                         (cat
  511.                             (cat "c:" prefix)
  512.                             ("Mount")
  513.                         )
  514.                     )
  515.                     ;Delete the "filesystem=" entry
  516.                     ;Case-sensitive!!! (yet another installer bug)
  517.                     (settooltype "FILESYSTEM")
  518.                 )
  519.             )
  520.         )
  521.  
  522.         ;Install gadtools13.library if running under 1.3.
  523.  
  524.         (if
  525.             (not ks20)
  526.             (
  527.                 (copyfiles
  528.                     (source ":libs/gadtools13.library")
  529.                     (dest "libs:")
  530.                     (newname "gadtools13.library")
  531.                 )
  532.             )
  533.         )
  534.  
  535.         ;Ask the user whether he has a floptical
  536.  
  537.         (set floptical
  538.             (askbool
  539.                 (prompt "Do you have a Floptical drive?")
  540.                 (help "If you aren't sure whether you have a Floptical, "
  541.                       "you don't have one."
  542.                 )
  543.             )
  544.         )
  545.  
  546.         ;Install Format
  547.  
  548.         (if floptical
  549.             (
  550.                 (copyfiles
  551.                     (source ":system/Format")
  552.                     (dest "sys:system")
  553.                     (newname (cat prefix "Format"))
  554.                 )
  555.             )
  556.             (
  557.                 (set mysource (cat ":system/Format" postfix))
  558.                 (set mydest "sys:system")
  559.                 (set mynewname (cat prefix "Format"))
  560.                 (mycopylib)
  561.             )
  562.         )
  563.  
  564.         (if errorflag
  565.             (
  566.                 (copyfiles
  567.                     (source ":system/Format.info")
  568.                     (dest "sys:system")
  569.                     (newname (cat prefix "Format.info"))
  570.                 )
  571.                 (tooltype
  572.                     (dest "sys:system/Format")
  573.                     (noposition)
  574.                 )
  575.             )
  576.         )
  577.  
  578.         ;Install alternate format icons (if floptical user)
  579.  
  580.         (if floptical
  581.             (
  582.                 (makedir "sys:system/Alt_Formats"
  583.                     (infos)
  584.                 )
  585.  
  586.                 (foreach ":system/Alt_Formats" "#?.Format.info"
  587.                     (
  588.                         (copyfiles
  589.                             (source
  590.                                 (cat ":system/Alt_Formats/" @each-name)
  591.                             )
  592.                             (dest "sys:system/Alt_Formats")
  593.                             (newname @each-name)
  594.                         )
  595.  
  596.                         ;Create a version of @each-name without the .info
  597.                         (set infoname
  598.                             (substr @each-name 0
  599.                                 (-
  600.                                     (strlen @each-name)
  601.                                     5
  602.                                 )
  603.                             )
  604.                         )
  605.  
  606.                         (tooltype
  607.                             (dest
  608.                                 (cat "sys:system/Alt_Formats/" infoname)
  609.                             )
  610.                             (noposition)
  611.                             (setdefaulttool
  612.                                 (cat
  613.                                     (cat "sys:system/" prefix)
  614.                                     ("Format")
  615.                                 )
  616.                             )
  617.                         )
  618.                     )
  619.                 )
  620.             )
  621.         )
  622.  
  623.         ;Install DiskCopy
  624.  
  625.         (set mysource (cat ":system/DiskCopy" postfix))
  626.         (set mydest "sys:system")
  627.         (set mynewname (cat prefix "DiskCopy"))    
  628.         (mycopylib)
  629.         (if errorflag
  630.             (
  631.                 (copyfiles
  632.                     (source ":system/DiskCopy.info")
  633.                     (dest "sys:system")
  634.                     (newname (cat prefix "DiskCopy.info"))
  635.                 )
  636.                 (tooltype
  637.                     (dest "sys:system/DiskCopy")
  638.                     (noposition)
  639.                 )
  640.             )
  641.         )
  642.  
  643.         ;Install the CrossDOS utility
  644.  
  645.         ;Copy FileSystem_Trans
  646.  
  647.         (copyfiles
  648.             (source ":l/FileSystem_Trans")
  649.             (dest "l:FileSystem_Trans")
  650.             (all)
  651.         )
  652.  
  653.         (copyfiles
  654.             (source (cat ":system/CrossDOS" postfix))
  655.             (dest "sys:system")
  656.             (newname "CrossDOS")
  657.         )
  658.         (copyfiles
  659.             (source ":system/CrossDOS.info")
  660.             (dest "sys:system")
  661.             (newname "CrossDOS.info")
  662.         )
  663.         (tooltype
  664.             (dest "sys:system/CrossDOS")
  665.             (noposition)
  666.         )
  667.  
  668.         ;Last copy operation -- copy DiskChg to sys:system
  669.  
  670.         (copyfiles
  671.             (source ":system/DiskChg")
  672.             (dest "sys:system")
  673.             (infos)    ;required!!!
  674.             (newname "DiskChg")
  675.         )
  676.         (tooltype
  677.             (dest "sys:system/DiskChg")
  678.             (noposition)
  679.         )
  680.  
  681.         ;Enter mount command in s:user-startup - ONLY if new user!!!
  682.         (if
  683.             (= old 0)
  684.             (
  685.                 (startup "CrossDOSV5+ - automatically mount all devices"
  686.                     (prompt "About to install a command in s:user-startup to automatically "
  687.                             "start CrossDOS when you boot your system..."
  688.                     )
  689.                     (help "Normally you want CrossDOS to be automatically invoked every "
  690.                           "time you start your system."
  691.                     )
  692.                     (command (cat prefix "Mount >nil: devs:DOSDrivers/~(#?.info)"))
  693.                 )
  694.             )
  695.         )
  696.  
  697.         ;Mount the stuff now so the user can use it immediately - if new user
  698.         (if
  699.             (= old 0)
  700.             ;This 'run' is safe because c: is an explicit path
  701.             (run
  702.                 (cat
  703.                     (cat "c:" prefix)
  704.                     ("Mount >nil: devs:DOSDrivers/~(#?.info)")
  705.                 )
  706.             )
  707.             (message "Because you seem to have previously installed CrossDOS, "
  708.                      "you may need to reboot your system for the CrossDOS V5 "
  709.                      "upgrade to take effect."
  710.             )
  711.         )
  712.  
  713.         (message "CrossDOS is now installed.")
  714.     )
  715. )
  716.  
  717. ;********************** CrossPC installation **************************
  718.  
  719. (procedure InstallCrossPC
  720.     (
  721.  
  722.         (if
  723.             (not
  724.                 (exists ":CrossPC")
  725.             )
  726.             (
  727.                 (message "This copy of CrossDOS does not include CrossPC. Exiting...")
  728.                 (exit
  729.                     (quiet)
  730.                 )
  731.             )
  732.         )
  733.  
  734.         (message "About to install CrossPC...")
  735.  
  736.         (if
  737.             (= 0
  738.                 (exists "l:CrossDOSFileSystem")
  739.             )
  740.             (
  741.                 (message "Note: CrossDOS V5 is not currently installed. It is "
  742.                          "STRONGLY suggested that you install CrossDOS before "
  743.                          "attempting to use CrossPC - or, if you prefer, invoke "
  744.                          "CrossDOS directly from the product disk."
  745.                 )
  746.                 (InstallTDPatch)
  747.                 (copyfiles
  748.                     (source ":devs/mfm.device")
  749.                     (dest "devs:")
  750.                     (newname "mfm.device")
  751.                 )
  752.             )
  753.         )
  754.  
  755.         (set pcdir
  756.             (askdir
  757.                 (prompt "Please select a drawer in which to install "
  758.                         "CrossPC"
  759.                 )
  760.                 (help "CrossPC is not picky about where you put it. Choose "
  761.                       "any drive/drawer. Use the \"Make New Drawer\" option "
  762.                       "to create a new drawer, if desired."
  763.                 )
  764.                 (default "sys:")
  765.             )
  766.         )
  767.         (copyfiles
  768.             (source ":CrossPC")
  769.             (dest pcdir)
  770.             (infos)    ;required!!!
  771.             (newname "CrossPC")
  772.         )
  773.  
  774.         ;Set memory size tooltype for CrossPC
  775.  
  776.         (set memopt
  777.             (askchoice
  778.                 (prompt "Select a default IBM memory size. (You may change it later "
  779.                         "by using the Info facility of Workbench)."
  780.                 )
  781.                 (help "If you have a reasonable amount of Amiga memory (3MB+) we "
  782.                       "recommend the 704K setting to maximize the ability "
  783.                       "of CrossPC. (NOTE: CrossPC does NOT support expanded or extended "
  784.                       "memory). However, if maximum compatibility is your primary "
  785.                       "concern, choose the 640K setting; a few (very few!) programs "
  786.                       "don't run with 704K of memory."
  787.                 )
  788.                 (choices "256K - recommended for 1MB systems"
  789.                          "384K"
  790.                          "512K"
  791.                          "640K - most compatible setting"
  792.                          "704K - recommended for 3MB+ systems"
  793.                 )
  794.             )
  795.         )
  796.         (if
  797.             (= memopt 0)
  798.             (set memtool "256")
  799.         )
  800.         (if
  801.             (= memopt 1)
  802.             (set memtool "384")
  803.         )
  804.         (if
  805.             (= memopt 2)
  806.             (set memtool "512")
  807.         )
  808.         (if
  809.             (= memopt 3)
  810.             (set memtool "640")
  811.         )
  812.         (if
  813.             (= memopt 4)
  814.             (set memtool "704")
  815.         )
  816.  
  817.         (tooltype
  818.             (dest (tackon pcdir "CrossPC"))
  819.             (noposition)
  820.             (settooltype "MEM1" memtool)
  821.         )
  822.  
  823.         (MountHD)
  824.         (SetHD)
  825.  
  826.         ;Check whether the user has a DF1:. If so, place B=PC1 in the
  827.         ;CrossPC tooltypes.
  828.  
  829.         (if
  830.             (not
  831.                 (= ""
  832.                     (getassign "df1" "d")
  833.                 )
  834.             )
  835.             (
  836.                 (tooltype
  837.                     (dest (tackon pcdir "CrossPC"))
  838.                     (noposition)
  839.                     (settooltype "B" "PC1")
  840.                 )
  841.             )
  842.         )
  843.  
  844.         ;Check whether the user has a DF2: but no DF1:. In that case,
  845.         ;modify the "b=" tooltype.
  846.  
  847.         (if
  848.             (= ""
  849.                 (getassign "df1" "d")
  850.             )
  851.             (
  852.                 (if
  853.                     (not
  854.                         (= ""
  855.                             (getassign "df2" "d")
  856.                         )
  857.                     )
  858.                     (
  859.                         (tooltype
  860.                             (dest (tackon pcdir "CrossPC"))
  861.                             (noposition)
  862.                             (settooltype "B" "PC2")
  863.                         )
  864.                     )
  865.                 )
  866.             )
  867.         )
  868.         (message "CrossPC is now installed.")
  869.     )
  870. )
  871.  
  872. ;********************** Configure Hard Disk **************************
  873.  
  874. (procedure ConfigureHardDisk
  875.     (
  876.  
  877.         ;Disallow pretend mode
  878.         (if @pretend
  879.             (
  880.                 (message "Sorry, you can't run the hard drive configuration in "
  881.                          "\"pretend\" mode. Exiting..."
  882.                 )
  883.                 (exit
  884.                     (quiet)
  885.                 )
  886.             )
  887.         )
  888.  
  889.         (if
  890.             (= 0
  891.                 (exists "l:CrossDOSFileSystem")
  892.             )
  893.             (
  894.                 (message "CrossDOS V5 is not currently installed. It must "
  895.                          "be installed before you can configure a hard drive. "
  896.                          "Switching to CrossDOS installation..."
  897.                 )
  898.                 (InstallCrossDOS)
  899.             )
  900.         )
  901.  
  902.         (set opt
  903.             (askchoice
  904.                 (choices "Configure on an Amiga Partition"
  905.                          "Configure a 100% MS-DOS Hard Disk"
  906.                 )
  907.                 (prompt "Please select an option. * Hit HELP for details!!! *")
  908.                 (help "If you wish to create a simulated MS-DOS hard drive "
  909.                       "on one of your Amiga hard drive partitions (note: "
  910.                       "the MS-DOS information will completely wipe out any Amiga "
  911.                       "files on that partition) select \"Configure on an Amiga "
  912.                       "Partition\". If you want to dedicate an entire PHYSICAL "
  913.                       "hard drive (or Syquest or Floptical or...) to storing "
  914.                       "MS-DOS information, select \"Configure a 100% MS-DOS Hard "
  915.                       "Disk\". Note that the configuration utility does not "
  916.                       "support very old controllers such as the Commodore A2090. "
  917.                       "In that case you must configure a MountList \"by hand\"."
  918.                 )
  919.             )
  920.         )
  921.  
  922.         ;Ask for drive prefix
  923.  
  924.         (set driveprefix
  925.             (askstring
  926.                 (default "PC")
  927.                 (prompt "Please enter a prefix to be assigned to the MS-DOS "
  928.                         "device you wish to configure.  A 'C' will be added "
  929.                         "to the end of the device name for you.  Please choose "
  930.                         "a device name that is not already in use.  "
  931.                         "\nPress HELP for details."
  932.                 )
  933.                 (help "You must enter a prefix (which may be any normal "
  934.                       "text, without spaces or any special characters) which will "
  935.                       "be used to access the MS-DOS drive/partition from AmigaDOS.  "
  936.                       "A letter of 'C' will be "
  937.                       "added by the configuration utility "
  938.                       "to form the complete drive name, as accessed from AmigaDOS. "
  939.                       "The relationship between the AmigaDOS drive name and the "
  940.                       "MS-DOS drive name (accessed by CrossPC or by a real IBM) is very "
  941.                       "simple. The last letter of the AmigaDOS name is the MS-DOS name. "
  942.                       "For example, PCC: refers to MS-DOS drive C:. The prefix to "
  943.                       "enter now would be PC (the default)."
  944.                 )
  945.             )
  946.         )
  947.  
  948.         ;Create a temporary directory
  949.  
  950.         (makedir "ram:CrossDOSTemp")
  951.  
  952.         (set MountListDir "ram:CrossDOSTemp")
  953.         (makedir MountListDir)
  954.  
  955.         ;Run the ConfigDev program
  956.  
  957.         (if
  958.             (= opt 0)
  959.             (set drivetype "AMIGA")
  960.             (set drivetype "MSDOS")
  961.         )
  962.         (set runargs
  963.             (cat
  964.                 (drivetype)
  965.                 (" -fL:CrossDOSFileSystem")
  966.             )
  967.         )
  968.         (set runargs
  969.             (cat
  970.                 (runargs)
  971.                 (cat
  972.                     (" -t")
  973.                     (MountListDir)
  974.                 )
  975.             )
  976.         )
  977.         (set runargs
  978.             (cat
  979.                 (runargs)
  980.                 (cat
  981.                     (" -p")
  982.                     (driveprefix)
  983.                 )
  984.             )
  985.         )
  986.         (run
  987.             (cat
  988.                 (cat @execute-dir "c/ConfigDisk ")
  989.                 runargs
  990.             )
  991.         )
  992.  
  993.         ;Create icons for the files in MountListDir and copy to DEVS:DOSDrivers
  994.         (set success 0)
  995.         (foreach MountListDir "#?"
  996.             (
  997.                 (set success 1)
  998.                 (set okflag 1)
  999.  
  1000.                 ;Check for "floptical" - ignore
  1001.  
  1002.                 (if
  1003.                     (= @each-name "floptical")
  1004.                     (set okflag 0)
  1005.                 )
  1006.  
  1007.                 ;Check whether the user already has a mountfile of the same name
  1008.                 (if okflag
  1009.                     (if
  1010.                         (exists
  1011.                             (cat
  1012.                                 ("devs:DOSDrivers/")
  1013.                                 (@each-name)
  1014.                             )
  1015.                         )
  1016.                         (
  1017.                             (set okflag
  1018.                                 (askbool
  1019.                                     (prompt "A file called \"" @each-name
  1020.                                             "\" already exists in your DEVS:DOSDrivers "
  1021.                                             "directory."
  1022.                                     )
  1023.                                     (choices "Overwrite"
  1024.                                              "Cancel"
  1025.                                     )
  1026.                                     (help "You may elect to overwrite the mountfile "
  1027.                                           "that currently exists, or abort the whole "
  1028.                                           "procedure."
  1029.                                     )
  1030.                                 )
  1031.                             )
  1032.                         )
  1033.                     )
  1034.                 )
  1035.  
  1036.                 (if okflag
  1037.                     (
  1038.                         (copyfiles
  1039.                             (source
  1040.                                 (cat
  1041.                                     (cat
  1042.                                         (MountListDir)
  1043.                                         ("/")
  1044.                                     )
  1045.                                     (@each-name)
  1046.                                 )
  1047.                             )
  1048.                             (dest "devs:DOSDrivers")
  1049.                             (infos)    ;just in case the DOSDrivers directory needs to be created.
  1050.                             (newname @each-name)
  1051.                         )
  1052.                         (copyfiles
  1053.                             (source ":PC0.info")
  1054.                             (dest "devs:DOSDrivers")
  1055.                             (newname (cat @each-name ".info"))
  1056.                         )
  1057.  
  1058.                         ;Determine what default tool to use (c:Mount or
  1059.                         ;c:CDMount).
  1060.  
  1061.                         ;Check to see whether the user has a c:CDMount. If so, set "prefix"
  1062.                         ;to "CD".
  1063.  
  1064.                         (if
  1065.                             (exists "c:CDMount")
  1066.                             (set prefix "CD")
  1067.                         )
  1068.  
  1069.                         (tooltype
  1070.                             (dest
  1071.                                 (cat
  1072.                                     ("devs:DOSDrivers/")
  1073.                                     (@each-name)
  1074.                                 )
  1075.                             )
  1076.                             (noposition)
  1077.                             (setdefaulttool
  1078.                                 (cat
  1079.                                     (cat "c:" prefix)
  1080.                                     ("Mount")
  1081.                                 )
  1082.                             )
  1083.                             ;Delete the "filesystem=" entry
  1084.                             ;Case-sensitive!!! (yet another installer bug)
  1085.                             (settooltype "FILESYSTEM")
  1086.                         )
  1087.                         (set harddisk @each-name)
  1088.                     )
  1089.                 )
  1090.             )
  1091.         )
  1092.  
  1093.         ;Delete the file created by ConfigDisk
  1094.         (if success
  1095.             (
  1096.                 (delete "ram:CrossDOSTemp/floptical")
  1097.                 (delete
  1098.                     (cat
  1099.                         ("ram:CrossDOSTemp/")
  1100.                         (harddisk)
  1101.                     )
  1102.                 )
  1103.  
  1104.                 ;Check whether the user selected "Install CrossPC". If not,
  1105.                 ;ask whether he wants to add this drive to CrossPC's tooltypes. etc
  1106.  
  1107.                 (if
  1108.                     (not
  1109.                         (in mainopt 2)
  1110.                     )
  1111.                     (
  1112.                         (MountHD)
  1113.                         (if
  1114.                             (or
  1115.                                 (= 1
  1116.                                     (exists "sys:CrossPC")
  1117.                                 )
  1118.                                 (= 1
  1119.                                     (exists "sys:CrossPC/CrossPC")
  1120.                                 )
  1121.                             )
  1122.                             (
  1123.                                 (if
  1124.                                     ;File?
  1125.                                     (= 1
  1126.                                         (exists "sys:CrossPC")
  1127.                                     )
  1128.                                     (
  1129.                                         (set pcdir "sys:")
  1130.                                         (SetHD)
  1131.                                     )
  1132.                                     (
  1133.                                         (set pcdir "sys:CrossPC")
  1134.                                         (SetHD)
  1135.                                     )
  1136.                                 )
  1137.                             )
  1138.                             (
  1139.                                 ;Ask the user whether he wants to set the CrossPC tooltype
  1140.                                 (if
  1141.                                     (askbool
  1142.                                         (prompt "If you have already installed CrossPC *and* "
  1143.                                                 "you wish to make the hard drive you configured "
  1144.                                                 "accessible to CrossPC, select \"Yes\"."
  1145.                                         )
  1146.                                         (help "If you select \"yes\", the installer will ask you "
  1147.                                               "where CrossPC has been installed. The installer "
  1148.                                               "will proceed to add a tooltype to the CrossPC icon."
  1149.                                         )
  1150.                                     )
  1151.                                     (
  1152.                                         (set notok 1)
  1153.                                         (while notok
  1154.                                             (
  1155.                                                 (set pcdir
  1156.                                                     (askdir
  1157.                                                         (prompt "Select the directory in which you "
  1158.                                                                 "installed CrossPC."
  1159.                                                         )
  1160.                                                         (help "The installer will proceed to add a tooltype "
  1161.                                                               "to the CrossPC icon."
  1162.                                                         )
  1163.                                                         (default "sys:")
  1164.                                                     )
  1165.                                                 )
  1166.                                                 (if
  1167.                                                     (= 1
  1168.                                                         (exists
  1169.                                                             (tackon pcdir "CrossPC")
  1170.                                                         )
  1171.                                                     )
  1172.                                                     (
  1173.                                                         (SetHD)
  1174.                                                         (set notok 0)
  1175.                                                     )
  1176.                                                     (
  1177.                                                         (message "CrossPC is not in the directory you selected.")
  1178.                                                     )
  1179.                                                 )
  1180.                                             )
  1181.                                         )
  1182.                                     )
  1183.                                 )
  1184.                             )
  1185.                         )
  1186.                     )
  1187.                 )
  1188.  
  1189.                 (if success
  1190.                     (message "Hard drive configuration is completed."
  1191.                         "\n\n############  WARNING!!!  ############"
  1192.                         "\nDO NOT use our Format command or the Amiga format command "
  1193.                         "to format " harddisk ":.  Instead, you must treat the "
  1194.                         "hard disk you just configured as an unformatted MS-DOS hard disk.  "
  1195.                         "This means you must use the FDISK and FORMAT commands "
  1196.                         "provided by MS-DOS to partition and format the hard disk.  "
  1197.                         "(Consult your MS-DOS manual about the use of these commands.)  "
  1198.                         "Failure to heed this warning may cause unpredictable results."
  1199.                     )
  1200.                     (message "Hard drive configuration could not be completed.")
  1201.                 )
  1202.             )
  1203.         )
  1204.  
  1205.         ;Delete the temporary directory created by this script
  1206.         (delete "ram:CrossDOSTemp")
  1207.     )
  1208. )
  1209.  
  1210. ;********************** Product Registration **************************
  1211.  
  1212. (procedure Register
  1213.     (
  1214.         (if
  1215.             (exists ":c/Registration")
  1216.             (
  1217.                 (run
  1218.                     (cat @execute-dir
  1219.                         (cat "c/Registration "
  1220.                             (cat @execute-dir "RegistrationInfo")
  1221.                         )
  1222.                     )
  1223.                 )
  1224.             )
  1225.             (message "The Product Registration utility was not completed in time "
  1226.                      "for shipment with CrossDOS V5+. Please fill out the "
  1227.                      "usual registration card and mail it in. Thank you!"
  1228.             )
  1229.         )
  1230.     )
  1231. )
  1232.  
  1233. ;***************************************************************************
  1234. ;***************************** MAIN ****************************************
  1235. ;***************************************************************************
  1236.  
  1237.  
  1238. ;Force user level to 1 or 2. This is unfortuntely required because otherwise
  1239. ;we can't present a menu of choices to the user.
  1240. (if
  1241.     (= @user-level 0)
  1242.     (
  1243.         (user 1)
  1244.         (set @user-level 0)
  1245.     )
  1246. )
  1247.  
  1248.  
  1249. ;Test whether we can access :l/CrossDOSFileSystem. If not, the user is
  1250. ;not running from the product disk - abort.
  1251.  
  1252. (if
  1253.     (not
  1254.         (exists ":l/CrossDOSFileSystem")
  1255.     )
  1256.     (
  1257.         (message "You must run the installation program from the "
  1258.                  "CrossDOS disk. Exiting..."
  1259.         )
  1260.         (exit
  1261.             (quiet)
  1262.         )
  1263.     )
  1264. )
  1265.  
  1266. ;Initialize certain variables
  1267. (set pcdir "")
  1268. (set harddisk "")
  1269.  
  1270. (set @execute-dir
  1271.     (expandpath ":")
  1272. )
  1273.  
  1274. ;get OS version number
  1275. (set osver
  1276.     (/
  1277.         (getversion "exec.library"
  1278.             (resident)
  1279.         )
  1280.         65536
  1281.     )
  1282. )
  1283.  
  1284. ;set ks20 variable to 1 if running 2.0 or above
  1285. (set ks20
  1286.     (> osver 36)
  1287. )
  1288.  
  1289.  
  1290. ;Check to see whether the user has a c:CDMount. If so, set "prefix"
  1291. ;to "CD".
  1292.  
  1293. (if
  1294.     (exists "c:CDMount")
  1295.     (set prefix "CD")
  1296. )
  1297.  
  1298.  
  1299. (while 1
  1300.     (
  1301.         ;Attempt to determine what the default menu options should be
  1302.         (set defmenu 0)
  1303.         (if
  1304.             (not
  1305.                 (exists "l:CrossDOSFileSystem")
  1306.             )
  1307.             (set defmenu
  1308.                 (bitor defmenu 9)
  1309.             )
  1310.         )
  1311.         (if
  1312.             (and
  1313.                 (not
  1314.                     (exists "sys:CrossPC")
  1315.                 )
  1316.                 (exists ":CrossPC")
  1317.             )
  1318.             (set defmenu
  1319.                 (bitor defmenu 12)
  1320.             )
  1321.         )
  1322.  
  1323.         ;Ask the user what he wants to install or do.
  1324.  
  1325.         (set mainopt
  1326.             (askoptions
  1327.                 (prompt "Please select all functions that you wish to perform")
  1328.                 (choices "Install CrossDOS"
  1329.                          "Configure Hard Disk for CrossDOS and CrossPC"
  1330.                          "Install CrossPC"
  1331.                          "Fill out Product Registration"
  1332.                 )
  1333.                 (default defmenu)
  1334.                 (help "The \"Install CrossDOS\" and \"Install CrossPC\" options install the "
  1335.                       "software. The \"Configure Hard Disk\" option will run ConfigDisk, "
  1336.                       "which allows you to set up a drive or partition for CrossPC and "
  1337.                       "CrossDOS. The \"Fill out Product Registration\" option will "
  1338.                       "prompt you for your name and address, and print it to PRT: (the "
  1339.                       "default printer). Using the registration software eliminates "
  1340.                       "the difficulties we sometimes have reading hand-written registration cards."
  1341.                 )
  1342.             )
  1343.         )
  1344.  
  1345.         (if
  1346.             (= mainopt 0)
  1347.             (
  1348.                 (message "You didn\'t select anything. Exiting...")
  1349.                 (exit
  1350.                     (quiet)
  1351.                 )
  1352.             )
  1353.         )
  1354.  
  1355.         (if
  1356.             (in mainopt 0)
  1357.             (InstallCrossDOS)
  1358.         )
  1359.         (if
  1360.             (in mainopt 1)
  1361.             (ConfigureHardDisk)
  1362.         )
  1363.         (if
  1364.             (in mainopt 2)
  1365.             (InstallCrossPC)
  1366.         )
  1367.         (if
  1368.             (in mainopt 3)
  1369.             (
  1370.                 (Register)
  1371.                 (exit
  1372.                     (quiet)
  1373.                 )
  1374.             )
  1375.             (
  1376.                 (exit
  1377.                     (quiet)
  1378.                 )
  1379.             )
  1380.         )
  1381.     )
  1382. )
  1383.